package db

import (
	"database/sql"
	"fucker/frame/config"
	"log"
	"os/user"
)
import _ "github.com/mattn/go-sqlite3"

func InitDb(c *config.Db) {
	path := c.Path
	if path == "" {
		current, _ := user.Current()
		path = current.HomeDir
	}

	sqldb, err := sql.Open("sqlite3", "appInfo")
	if err != nil {
		log.Fatal(err)
	}
	err = sqldb.Ping()
	if err != nil {
		log.Fatal(err)
	}
	log.Println("connect to ", "appInfo", "ok")
}
